#include <stdlib.h>
#include "list_node.h"

#ifndef LinkedList_
#define LinkedList_

typedef struct list {
	int size;
	ListNode *head;
	ListNode *tail;
} LinkedList;
#endif

#include "list.c"

/*
 * Initializes an empty linked list.
 */
LinkedList* create_LinkedList();

/*
 * Destroys the list provided by freeing up all the nodes and freeing the
 * entire list.  If the list provided is NULL, the program will exit with an
 * error.
 */
int destroy_LinkedList(LinkedList* list);

/*
 * Adds the data to the end of the list.  If the list is NULL,
 * the program will exit with an error message.
 */
int list_add(LinkedList* list, int data);

/**
 * Adds the data to the index provided, 0 is the front of the list.
 * If the index provided is greater than the size or less than 0,
 * the program will exit with an error.
 * If the list is NULL, the program will exit with an error.
 */
int list_add_at_index(LinkedList* list, int index, int data);

/*
 * Removes the front of the list.  If the list is NULL or empty, the
 * program will exit with an error message.
 */
int list_remove(LinkedList* list);

/*
 * Removes the node at the index provided.  0 is the front of the list.
 * If the index is greater than the size - 1 or less than 0,
 * the program will exit with an error message.
 */
int list_remove_from_index(LinkedList* list, int index);

/*
 * Prints the list to the console with the format #, #, #, #, etc....
 * If the list is NULL, the program will print a message indicating so, but will
 * not exit.  If the list is empty, a similar message will be output.
 */
void list_print(LinkedList* list);

/*
 * Returns if the list is empty or not.  If the list is NULL, an error is output and the
 * program will exit.  TRUE and FALSE are returned, and these are determined
 * by globals.h.
 */
int list_is_empty(LinkedList* list);

